package gui;

import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JList;

/**
 *
 * @author Mariano Zapata
 */
public class RenderListaGuardar extends DefaultListCellRenderer {
    
    public RenderListaGuardar() {
        super();
    }
    
    @Override
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
            boolean cellHasFocus)
    {
        JLabel label= (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        JCheckBox ret= new JCheckBox();
        ret.setSize(label.getSize());
        ret.setText(label.getText());
        ret.setBackground(label.getBackground());
        ret.setForeground(label.getForeground());
        ret.setFont(label.getFont());
        ret.setEnabled(label.isEnabled());
        ret.setSelected(((ItemGuardar) value).estaSeleccionado());
        return ret;
    }
}
